#include <iostream>
#include <string.h>
int xxx = 1;
namespace ys {
    int xxx = 0;
}
void* memcpy(void* desc, const void* src, int len)
{
    if (desc == NULL || src == NULL)
    {
        return NULL;
    }

    char* tempSrc = (char*)src;
    char* tempDec = (char*)desc;
    while( len-- > 0)
    {
        *tempDec++ = *tempSrc++;
    }

    return desc;
}

void swap(const int* a, int* b, int len)
{
    b[0] = 1;
    for (int i = 1; i < len; i++)
    {
        b[i] = b[i-1] * a[i-1];
    }
    int temp = 1;
    for (int i = len - 2; i >= 0; i--)
    {
        temp *= a[i+1];
        b[i] *= temp;
    }
    for (int k = 0; k < len; k++)
    {
        std::cout << b[k] << " " ;
    }
}

struct t {
    char a;
    int  x[0];
    short b;
};

// 测试CPU大小端
bool IsBig()
{
    short int x = 0x1234;
    char* t = (char*)&x;
    if(*t == 0x12)
    {
        return true;
    }
    else
    {
        return false;
    }
}

// 测试括号匹配
bool testkuohao(char* a)
{
    std::cout << sizeof(a) << " " << ys::xxx << "ccccccccccccccc " << (-17)%10 << std::endl;
    
}


int main()
{
    auto i = 11;
    std::cout << "hahahaha" << i << std::endl;
    char q[12];
    memcpy(q,"2222eed", 8);
    std::cout << "hahahaha " << (char*)q << std::endl;

    int a[] = {3,2,5,4,3,2};
    int b[] = {0,0,0,0,0,0};
    swap(a,b,6);
    t m;
    std::cout << sizeof(t) << std::endl;
    std::cout << IsBig() << std::endl;
    char xxx[] = {'a','b'};
    testkuohao(xxx);
    char aa[] = {0,2,5,5,6};
    aa[0] = 0x100 + *aa + strlen(aa) + sizeof(aa);
    std::cout << (int)aa[0] << std::endl;

    int *p1 = new int[10]; 
    int *p2 = new int[10]();
    std::cout << p1[1] << " " << p2[1] << std::endl;
    return 0;
}